package com.dek.seckill.mapper;


import com.dek.seckill.vo.GoodsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface GoodsMapper {

    @Select("select g.*, sg.stock AS 'seckillStock',sg.seckill_price AS 'seckillPrice', sg.start_date, sg.end_date" +
            " from seckill_goods sg " +
            "left join goods g on sg.goods_id = g.id")
    List<GoodsVO> getGoodsVOList();

    @Select("select g.*, sg.stock AS 'seckillStock',sg.seckill_price AS 'seckillPrice', sg.start_date, sg.end_date " +
            "from seckill_goods sg " +
            "left join goods g on sg.goods_id = g.id where g.id = #{goodsId}")
    GoodsVO getDetail(@Param("goodsId") Long goodsId);
}
